//go:generate stringer -type ErrCode -linecomment
package code

import (
	"fmt"
	"strconv"
	"strings"
)

type ErrCode int64 // 错误码
const (
	// ErrCodeOk - 200: OK.
	ErrCodeOk ErrCode = 0 // ok
	// ErrCodeInvalidParams - 400: Invalid
	ErrCodeInvalidParams ErrCode = 1 // 参数错误
	// ErrCodeTimeout - 500: Timeout
	ErrCodeTimeout ErrCode = 2 // 超时
)

func register(err ErrCode, errCode int, errMsg string) {
	fmt.Println(strings.Join([]string{err.String(), strconv.Itoa(errCode), errMsg}, "|"))
}
